package org.xg.study.pd;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xg.study.pd.cuisine.ICuisine;

import java.util.ArrayList;
import java.util.List;

/**
 * @author CMG
 * @version 1.0
 * @description
 * @cLassName XiaoEr
 * @date 2021/9/16 14:40
 **/
public class XiaoEr {
    private Logger logger = LoggerFactory.getLogger(XiaoEr.class);

    private List<ICuisine> cuisineList = new ArrayList<>();

    public void order(ICuisine cuisine) {
        cuisineList.add(cuisine);
    }

    public synchronized void placeOrder() {
        for (ICuisine cuisine : cuisineList) {
            cuisine.cook();
        }
        cuisineList.clear();
    }
}
